# -*- coding: utf-8 -*-

%if c.biblio is not None:
<form action='update/${c.biblio.id}' id='${c.biblio.id}' method='post'> 
 <table bgcolor="#E6E8F8" width="100%">
    <tr><td colspan='3' class='info'>Редактирование номенклатуры: "${ c.biblio.name }"</td></tr>
    <tr><td width="10%"><b>Наименование: </b></td><td><input name='name' value='${ c.biblio.name }' size='50' class='BoxCenter' type='text'></td><td><div id='name${ c.biblio.id }' class='error'></td></tr>
    <%
        if c.biblio.author is None: c.biblio.author = ''
        if c.biblio.publishing is None: c.biblio.publishing = ''
        if c.biblio.year is None: c.biblio.year = ''
        if c.biblio.pages is None: c.biblio.pages = ''
        if c.biblio.annote is None: c.biblio.annote =''
        if c.biblio.place is None: c.biblio.place =''
        if c.biblio.note is None: c.biblio.note =''
        
    %>
    <tr><td><b>Автор: </b></td><td><input name='author' value='${ c.biblio.author }' size='50' class='BoxCenter' type='text'></td><td><div id='author${ c.biblio.id }' class='error'></td></tr>    
    <tr><td><b>Издание: </b></td><td><input name='publishing' value='${ c.biblio.publishing }' size='50' class='BoxCenter' type='text'></td><td><div id='publishing${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Год выпуска: </b></td><td><input name='year' value='${ c.biblio.year }' size='10' class='BoxCenter' type='text'></td><td><div id='year${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Объем (стр.): </b></td><td><input name='pages' value='${ c.biblio.pages }' size='10' class='BoxCenter' type='text'></td><td><div id='pages${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Тип: </b></td>
    <td><select name="biblio_type_id" class="BoxCenter">
    %for type in c.bibliotype:
        %if type.id == c.biblio.biblio_type.id:
           <option value="${ type.id }" selected=""> ${ type.name }</option>
        %else:
            <option value="${ type.id }">${ type.name }</option>
        %endif
    %endfor
    </td><td><div id='biblio_type${ c.biblio.id }' class='error'></td></tr>


    <tr><td><b>Жанр: </b></td>
    <td><select name="category_id" class="BoxCenter">
    %for categ in c.category:
        %if categ.id == c.biblio.category.id:    
            <option value="${ categ.id }" selected="">${ categ.name }</option>
        %else: 
            <option value="${ categ.id }">${ categ.name }</option>
        %endif
    %endfor
    </td><td><div id='category${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Анотация: </b></td><td><textarea name='annote' cols='50' rows='3' class='BoxCenter'>${c.biblio.annote}</textarea></td><td><div id='annote${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Расположение: </b></td><td><textarea name='place' cols='50' rows='3' class='BoxCenter'>${ c.biblio.place }</textarea></td><td><div id='place${ c.biblio.id }' class='error'></td></tr>
    <tr><td><b>Примечание: </b></td><td><textarea name='note' cols='50' rows='3' class='BoxCenter'>${ c.biblio.note }</textarea></td><td><div id='note${ c.biblio.id }' class='error'></td></tr>
    <tr><td></td><td>
    <input value="Закрыть" class="BoxCenter" onclick='document.getElementById("fullview${ c.biblio.id }").innerHTML="";' align="alleft" type="reset">
% else:
<form action="create" method="post">
 <table width="100%" class="BoxCenterAdd">    
    <tr><td colspan='3' class='info'>Добавление номенклатуры</td></tr>
    <tr><td width="10%"><b>Наименование: </b></td><td><input name='name' value='' size='50' class='BoxCenter' type='text'></td><td><div id='name' class='error'></td></tr>    
    <tr><td><b>Автор: </b></td><td><input name='author' value='' size='50' class='BoxCenter' type='text'></td><td><div id='author' class='error'></td></tr>
    <tr><td><b>Издание: </b></td><td><input name='publishing' value='' size='50' class='BoxCenter' type='text'></td><td><div id='publishing' class='error'></td></tr>
    <tr><td><b>Год выпуска: </b></td><td><input name='year' value='' size='10' class='BoxCenter' type='text'></td><td><div id='year' class='error'></td></tr>
    <tr><td><b>Объем (стр.): </b></td><td><input name='pages' value='' size='10' class='BoxCenter' type='text'></td><td><div id='pages' class='error'></td></tr>


    <tr><td><b>Тип: </b></td>
    <td><select name="biblio_type_id" class="BoxCenter">
%  for type in c.bibliotype:
        <option value="${ type.id }">${ type.name }</option>
%  endfor
    </td><td><div id='biblio_type' class='error'></td></tr>


    <tr><td><b>Жанр: </b></td>
    <td><select name="category_id" class="BoxCenter">
%  for categ in c.category:
        <option value="${ categ.id }">${ categ.name }</option>
%  endfor
    </td><td><div id='category' class='error'></td></tr>

    <tr><td><b>Анотация: </b></td><td><textarea name='annote' cols='50' rows='3' class='BoxCenter'></textarea></td><td><div id='annote' class='error'></td></tr>
    <tr><td><b>Расположение: </b></td><td><textarea name='place' cols='50' rows='3' class='BoxCenter'></textarea></td><td><div id='place' class='error'></td></tr>
    <tr><td><b>Примечание: </b></td><td><textarea name='note' cols='50' rows='3' class='BoxCenter'></textarea></td><td><div id='note' class='error'></td></tr>
    <tr><td></td><td>
    
    <input value="Закрыть" class="BoxCenter" onclick='document.getElementById("add").innerHTML="";' align="alleft" type="reset">
% endif

   <input value="Сохранить" type="submit" class="BoxCenter">
 </td></tr>

</table>
</form>
